import request, {postJson} from "@/apps/admin/utils/request";


const server = "/v1/admin"
export const getInstruments = (params) => request.get(`${server}/getInstruments`, {params})

export const createInstrument = (data) => postJson(`${server}/createInstrument`, data)

export const getInstrumentSubTypes = () => request.get(`${server}/getInstrumentSubTypes`)
export const deleteInstrumentSubType = (data) => postJson(`${server}/deleteInstrumentSubType`, data)


export const updateInstrument = (data: object) => postJson(`${server}/updateInstrument`, data)
export const deleteInstrument = (data: object) => postJson(`${server}/deleteInstrument`, data)

export const getBorrowRecords = (page, pageSize) => {
    return request.get(`${server}/instrument-borrows`, {
        params: { page, pageSize }
    })
}

// 获取待审核借用记录
export const getInstrumentBorrowsByPending = () => {
    return request.get(`${server}/getInstrumentBorrowsByNotReview`)
}



// 审核通过
export const approveBorrow = (id) => {
    return request.post(`${server}/approveInstrumentBorrow`)
}

// 审核拒绝
export const rejectBorrow = (id) => {
    return request.post(`${server}/rejectInstrumentBorrow`)
}
// 新增借用记录
// export const createBorrowRecord = (data) => {
//     return request.post(`${server}/loan-borrows`, data)
// }